/* ===========================================================
 * APGraphClusteringPlugin : Java implementation of affinity propagation
 * algorithm as Cytoscape plugin.
 * ===========================================================
 *
 *
 * Project Info:  http://bioputer.mimuw.edu.pl/modevo/
 * Sources: http://code.google.com/p/misiek/
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>
 *
 * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
 * in the United States and other countries.]
 *
 * APGraphClusteringPlugin  Copyright (C) 2008-2010
 * Authors:  Michal Wozniak (code) (m.wozniak@mimuw.edu.pl)
 *           Janusz Dutkowski (idea) (j.dutkowski@mimuw.edu.pl)
 *           Jerzy Tiuryn (supervisor) (tiuryn@mimuw.edu.pl)
 */
package panel;

import java.awt.GridLayout;
import java.awt.Label;
import java.awt.TextField;
import javax.swing.JPanel;
import javax.swing.JTextField;

public class AffinityPanel extends javax.swing.JPanel {

    private AffinityPanelController pc = null;
    public static JTextField epsilon;

    /** Creates new form AffinityPanel */
    public AffinityPanel() {
        initComponents();
    }

    /** Creates new form AffinityPanel
     * @param pc
     */
    public AffinityPanel(final AffinityPanelController pc) {
        this.pc = pc;
        initComponents();
        pc.setCovitsField(convitsField);
        pc.setEdgeAttrField(edgeAttrCombo);
        pc.setNodeAttrField(nodeAttrNameField);
        pc.setIterationsField(iterationsSpinner);
        pc.setLambdaField(labmbdaField);
        // pc.setDirecedGraphRadio();
        pc.setPreferencesField(preferenceField);
        //   pc.setRefineCheckBox(refineCheckBox);
        pc.setLogCheckBox(transformingCheckbox);
        pc.setCentersAttrField(centersNameAttrField);
        pc.setNoiseCheckBox(noiseCheckBox);
        //    pc.setNoiseCheckBox(noiseCheckbox);
        pc.initPanelFields();

        //   setLayout();

        //AffinityPanel.epsilon = epsilonField;
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        parametersPanel = new javax.swing.JPanel();
        jPanel2 = new javax.swing.JPanel();
        edgeAttrNameLabel = new javax.swing.JLabel();
        iteretionsLabel = new javax.swing.JLabel();
        convitsLabel = new javax.swing.JLabel();
        preferenceLabel = new javax.swing.JLabel();
        lambdaLabel = new javax.swing.JLabel();
        jPanel3 = new javax.swing.JPanel();
        edgeAttrCombo = new javax.swing.JComboBox();
        iterationsSpinner = new javax.swing.JSpinner();
        convitsField = new javax.swing.JTextField();
        refreshButton1 = new javax.swing.JButton();
        labmbdaField = new javax.swing.JTextField();
        preferenceField = new javax.swing.JTextField();
        refreshButton = new javax.swing.JButton();
        jPanel4 = new javax.swing.JPanel();
        noiseCheckBox = new javax.swing.JCheckBox();
        transformingCheckbox = new javax.swing.JCheckBox();
        transforminLabel = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jPanel1 = new javax.swing.JPanel();
        jPanel8 = new javax.swing.JPanel();
        nodeAttrNameField = new javax.swing.JTextField();
        centersNameAttrField = new javax.swing.JTextField();
        jPanel7 = new javax.swing.JPanel();
        jLabel2 = new javax.swing.JLabel();
        nodeAttrNameLabel = new javax.swing.JLabel();

        setMaximumSize(new java.awt.Dimension(280, 32767));

        parametersPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Paremeters"));
        parametersPanel.setMaximumSize(new java.awt.Dimension(280, 32767));
        parametersPanel.setName("parametersPanel"); // NOI18N

        jPanel2.setName("jPanel2"); // NOI18N

        edgeAttrNameLabel.setText("Edge weight attribute:");
        edgeAttrNameLabel.setName("edgeAttrNameLabel"); // NOI18N

        iteretionsLabel.setText("Number of iterations:");
        iteretionsLabel.setName("iteretionsLabel"); // NOI18N

        convitsLabel.setText("Stop criterion:");
        convitsLabel.setName("convitsLabel"); // NOI18N

        preferenceLabel.setText("Preference:");
        preferenceLabel.setName("preferenceLabel"); // NOI18N

        lambdaLabel.setText("Lambda:");
        lambdaLabel.setName("lambdaLabel"); // NOI18N

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lambdaLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 108, Short.MAX_VALUE)
                    .addComponent(preferenceLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 108, Short.MAX_VALUE)
                    .addComponent(edgeAttrNameLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(iteretionsLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 108, Short.MAX_VALUE)
                    .addComponent(convitsLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 108, Short.MAX_VALUE)))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addComponent(edgeAttrNameLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(iteretionsLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(convitsLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(preferenceLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(lambdaLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 21, Short.MAX_VALUE)
                .addContainerGap())
        );

        jPanel3.setName("jPanel3"); // NOI18N

        edgeAttrCombo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "DEFAULT" }));
        java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("panel/ui_properties"); // NOI18N
        edgeAttrCombo.setToolTipText(bundle.getString("EdgeWeightAttributeCombobox")); // NOI18N
        edgeAttrCombo.setName("edgeAttrCombo"); // NOI18N
        edgeAttrCombo.setPreferredSize(new java.awt.Dimension(70, 21));
        edgeAttrCombo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                edgeAttrComboActionPerformed(evt);
            }
        });

        iterationsSpinner.setToolTipText(bundle.getString("NumberOfIterationsField")); // NOI18N
        iterationsSpinner.setName("iterationsSpinner"); // NOI18N
        iterationsSpinner.setPreferredSize(new java.awt.Dimension(26, 21));
        iterationsSpinner.setValue(200);

        convitsField.setText("10");
        convitsField.setToolTipText(bundle.getString("StopCriterionField")); // NOI18N
        convitsField.setName("convitsField"); // NOI18N
        convitsField.setPreferredSize(new java.awt.Dimension(18, 21));

        refreshButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/icons/refresh.png"))); // NOI18N
        refreshButton1.setToolTipText(bundle.getString("RefreshButton.ToolTip")); // NOI18N
        refreshButton1.setMargin(new java.awt.Insets(1, 0, 1, 0));
        refreshButton1.setName("refreshButton"); // NOI18N
        refreshButton1.setPreferredSize(new java.awt.Dimension(25, 21));
        refreshButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                refreshButton1ActionPerformed(evt);
            }
        });

        labmbdaField.setText("0.5");
        labmbdaField.setToolTipText(bundle.getString("LambdaField")); // NOI18N
        labmbdaField.setName("labmbdaField"); // NOI18N
        labmbdaField.setPreferredSize(new java.awt.Dimension(22, 21));
        labmbdaField.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                labmbdaFieldActionPerformed(evt);
            }
        });

        preferenceField.setText("0.5");
        preferenceField.setToolTipText(bundle.getString("PreferenceField")); // NOI18N
        preferenceField.setName("preferenceField"); // NOI18N
        preferenceField.setPreferredSize(new java.awt.Dimension(22, 21));
        preferenceField.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                preferenceFieldActionPerformed(evt);
            }
        });

        refreshButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/icons/refresh.png"))); // NOI18N
        refreshButton.setToolTipText(bundle.getString("ReloadButton.ToolTip")); // NOI18N
        refreshButton.setMargin(new java.awt.Insets(1, 0, 1, 0));
        refreshButton.setName("reloadButton"); // NOI18N
        refreshButton.setPreferredSize(new java.awt.Dimension(25, 21));
        refreshButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                refreshButtonActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addComponent(preferenceField, javax.swing.GroupLayout.DEFAULT_SIZE, 84, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(refreshButton1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
            .addComponent(convitsField, javax.swing.GroupLayout.DEFAULT_SIZE, 115, Short.MAX_VALUE)
            .addComponent(iterationsSpinner, javax.swing.GroupLayout.DEFAULT_SIZE, 115, Short.MAX_VALUE)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
                .addComponent(edgeAttrCombo, 0, 84, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(refreshButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
            .addComponent(labmbdaField, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 115, Short.MAX_VALUE)
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(refreshButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(edgeAttrCombo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(iterationsSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(convitsField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(preferenceField, javax.swing.GroupLayout.DEFAULT_SIZE, 23, Short.MAX_VALUE)
                    .addComponent(refreshButton1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(labmbdaField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        jPanel4.setName("jPanel4"); // NOI18N

        noiseCheckBox.setSelected(true);
        noiseCheckBox.setToolTipText(bundle.getString("NoiseCheckbox")); // NOI18N
        noiseCheckBox.setName("noiseCheckBox"); // NOI18N

        transformingCheckbox.setToolTipText(bundle.getString("TakeLogCheckbox")); // NOI18N
        transformingCheckbox.setName("transformingCheckbox"); // NOI18N

        transforminLabel.setText("Log transform edge weights:");
        transforminLabel.setName("transforminLabel"); // NOI18N

        jLabel3.setText("Add noise:");
        jLabel3.setName("jLabel3"); // NOI18N

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(103, 103, 103))
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addComponent(transforminLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 178, Short.MAX_VALUE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)))
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(transformingCheckbox, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(noiseCheckBox, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addGap(30, 30, 30))
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(transforminLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 18, Short.MAX_VALUE))
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addComponent(noiseCheckBox)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(transformingCheckbox))
        );

        javax.swing.GroupLayout parametersPanelLayout = new javax.swing.GroupLayout(parametersPanel);
        parametersPanel.setLayout(parametersPanelLayout);
        parametersPanelLayout.setHorizontalGroup(
            parametersPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, parametersPanelLayout.createSequentialGroup()
                .addGroup(parametersPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jPanel4, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, parametersPanelLayout.createSequentialGroup()
                        .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                .addContainerGap())
        );
        parametersPanelLayout.setVerticalGroup(
            parametersPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(parametersPanelLayout.createSequentialGroup()
                .addGroup(parametersPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Output attributes", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.TOP));
        jPanel1.setName("jPanel1"); // NOI18N

        jPanel8.setName("jPanel8"); // NOI18N

        nodeAttrNameField.setText("cluster_id");
        nodeAttrNameField.setToolTipText(bundle.getString("ClusterIDField")); // NOI18N
        nodeAttrNameField.setMargin(new java.awt.Insets(1, 1, 2, 1));
        nodeAttrNameField.setName("nodeAttrNameField"); // NOI18N
        nodeAttrNameField.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                nodeAttrNameFieldActionPerformed(evt);
            }
        });

        centersNameAttrField.setText("center_id");
        centersNameAttrField.setToolTipText("<html> Name of the center attribute which will store cluster assignments </html>");
        centersNameAttrField.setAlignmentY(0.0F);
        centersNameAttrField.setMargin(new java.awt.Insets(1, 1, 2, 1));
        centersNameAttrField.setName("centersNameAttrField"); // NOI18N

        javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(jPanel8);
        jPanel8.setLayout(jPanel8Layout);
        jPanel8Layout.setHorizontalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel8Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(centersNameAttrField, javax.swing.GroupLayout.DEFAULT_SIZE, 123, Short.MAX_VALUE)
                    .addComponent(nodeAttrNameField, javax.swing.GroupLayout.DEFAULT_SIZE, 123, Short.MAX_VALUE)))
        );
        jPanel8Layout.setVerticalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel8Layout.createSequentialGroup()
                .addComponent(nodeAttrNameField, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(centersNameAttrField, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(11, Short.MAX_VALUE))
        );

        jPanel7.setName("jPanel7"); // NOI18N

        jLabel2.setText("Center ID:");
        jLabel2.setName("jLabel2"); // NOI18N

        nodeAttrNameLabel.setText("Cluster ID:");
        nodeAttrNameLabel.setName("nodeAttrNameLabel"); // NOI18N

        javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7);
        jPanel7.setLayout(jPanel7Layout);
        jPanel7Layout.setHorizontalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(nodeAttrNameLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 78, Short.MAX_VALUE)
                    .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, 78, Short.MAX_VALUE)))
        );
        jPanel7Layout.setVerticalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addComponent(nodeAttrNameLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(12, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addComponent(jPanel7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(161, Short.MAX_VALUE))
            .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                    .addContainerGap(106, Short.MAX_VALUE)
                    .addComponent(jPanel8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap()))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(jPanel8, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(parametersPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(parametersPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
        );
    }// </editor-fold>//GEN-END:initComponents

    private void labmbdaFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_labmbdaFieldActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_labmbdaFieldActionPerformed

    private void preferenceFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_preferenceFieldActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_preferenceFieldActionPerformed

    private void edgeAttrComboActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_edgeAttrComboActionPerformed
        pc.refreshPreferences();
    }//GEN-LAST:event_edgeAttrComboActionPerformed

    private void refreshButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_refreshButtonActionPerformed
        pc.refreshEdgeAttrField();
        pc.refreshPreferences();
}//GEN-LAST:event_refreshButtonActionPerformed

    private void refreshButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_refreshButton1ActionPerformed
        pc.refreshPreferences();
    }//GEN-LAST:event_refreshButton1ActionPerformed

    private void nodeAttrNameFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_nodeAttrNameFieldActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_nodeAttrNameFieldActionPerformed
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JTextField centersNameAttrField;
    private javax.swing.JTextField convitsField;
    private javax.swing.JLabel convitsLabel;
    private javax.swing.JComboBox edgeAttrCombo;
    private javax.swing.JLabel edgeAttrNameLabel;
    private javax.swing.JSpinner iterationsSpinner;
    private javax.swing.JLabel iteretionsLabel;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JPanel jPanel8;
    private javax.swing.JTextField labmbdaField;
    private javax.swing.JLabel lambdaLabel;
    private javax.swing.JTextField nodeAttrNameField;
    private javax.swing.JLabel nodeAttrNameLabel;
    private javax.swing.JCheckBox noiseCheckBox;
    private javax.swing.JPanel parametersPanel;
    private javax.swing.JTextField preferenceField;
    private javax.swing.JLabel preferenceLabel;
    private javax.swing.JButton refreshButton;
    private javax.swing.JButton refreshButton1;
    private javax.swing.JLabel transforminLabel;
    private javax.swing.JCheckBox transformingCheckbox;
    // End of variables declaration//GEN-END:variables

    private void setLayout() {
        JPanel leftPanel = new JPanel();
        leftPanel.setLayout(new GridLayout(5, 1));
        leftPanel.add(new Label("saassasa"));
        leftPanel.add(new Label("sasaas"));
        leftPanel.add(new Label("stop criterium"));
        leftPanel.add(new Label("stop criterium2"));
        leftPanel.add(new Label("stop criter"));
        leftPanel.setVisible(true);

        JPanel rightPanel = new JPanel();
        rightPanel.setLayout(new GridLayout(5, 1));
        rightPanel.add(new TextField("2"));
        rightPanel.add(new TextField("323"));
        rightPanel.add(new TextField("3223"));
        rightPanel.add(new TextField("32--23"));
        rightPanel.add(new TextField("32-"));


        rightPanel.setVisible(true);

        jPanel2.setLayout(new GridLayout(1, 2));
        jPanel2.add(leftPanel);
        jPanel2.add(rightPanel);
        jPanel2.setVisible(true);
    }
}
